<?php
namespace app\yhUtil;

use app\yhUtil\type\File;
use app\yhUtil\type\Text;
use app\yhUtil\type\Image;
use app\yhUtil\type\Video;
use app\yhUtil\type\Markdown;

/**
 * @method static Text Text($text = '', $message=[])
 * @method static Markdown Markdown($markdown = '', $message=[])
 * @method static Image Image($imagePath = '', $message=[])
 * @method static File File($file = '', $message=[])
 * @method static Video Video($videoPath = '', $message=[])
 */
class YhApi {
    public static function __callStatic($name, $arguments)
    {
        $class = __NAMESPACE__.'\\type\\'.$name;
        if(!class_exists($class)) {
            return new Text("找不到该类型[{$class}]的消息处理方法", $arguments[1]);
        }
        $obj = new $class(...$arguments);
        return $obj;
    }
}
